package outside

import (
	"time"

	kanetmsg "kiwi/actor/net/message"
)

type IMessage interface {
	kanetmsg.IMessage
	Outside()
	Once() bool
	MinInterval() time.Duration
}

type factory = kanetmsg.Factory[IMessage]

var gFactoryManager = map[kanetmsg.ID]*factory{}

func Register(iMsg IMessage, producer func() IMessage) error {
	return kanetmsg.Register(gFactoryManager, iMsg, producer)
}

func MustRegister(iMsg IMessage, producer func() IMessage) {
	kanetmsg.MustRegister(gFactoryManager, iMsg, producer)
}
